$(function(){
$.ajax({
    url:'../interface/getitems.php',
    type:'get',
    dataType:'json'
}).then(res=>{


let template='';   

res.forEach(elm=>{

let pic= JSON.parse(elm.picture);

let href= `./item.html?id=${elm.id}`

template +=`<div class="item">
<a href="./item.html?id=${elm.id}">
<div class="img-wrapper">
<img src="./${pic[0].src}" alt="">
</div>
<h4 class="title">${elm.title}</h4>
</a>
<p class="info">
<span class="marks hotsale-hide"></span>
<span class="price"><em>￥</em>${elm.price}</span>
</p>
</div>`

$('.list').html(template);

// $('.item>a').attr({src:href});

// $('.img-wrapper').html(`<img src="./${pic[0].src}" alt="">`);

// $('.title').html(`${elm.title}`);

// $('.price').html(`<em>￥</em>${elm.price}`);

});



}).catch(xhr=>{
   
})
})